package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.QueryString;
import com.itheima.entity.Result;
import com.itheima.pojo.Order;
import com.itheima.pojo.Setmeal;
import com.itheima.service.OrderSettingListService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/ordersettinglist")
public class OrderSettingListController {
    @Reference
    private OrderSettingListService orderSettingListService;

    //分页查询
    @RequestMapping("/findPage")
    public PageResult findPage(@RequestBody QueryString queryString)throws Exception {
        return orderSettingListService.findPage(queryString);
    }

    //查询所有套餐信息
    @RequestMapping("/findAll")
    public Result findAll() {
        try {
            //调用findAll方法查询套餐信息
            List<Setmeal> list = orderSettingListService.findAll();
            return new Result(true,MessageConstant.GET_ORDER_LIST_SUCCESS,list);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,MessageConstant.GET_ORDER_LIST_FAIL);
        }
    }


}
